<?php
$con = mysqli_connect ( "localhost", "root", "", "lifeway" );
// Check connection
if (mysqli_connect_errno ()) {
	echo "Failed to connect to MySQL: " . mysqli_connect_error ();
}

$result = mysqli_query ( $con, "SELECT id, nome, precode, precopor, divididomaximo FROM produtos" );

$arr = array ();

while ( $row = mysqli_fetch_array ( $result ) ) {
	//var_dump($row);	
	array_push ( $arr, $row );
}

mysqli_close ( $con );

echo json_encode ( $arr );
?>

